package com.sebklebes.radar.dialogs;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;

public class DialogActivity extends Activity {

	private Dialog dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setVisible(false);

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			int action = extras.getInt(DialogFactory.DIALOGS);
			String message = extras.getString(DialogFactory.MESSAGE);
			Dialog dialog = DialogFactory.getDialog(action, DialogActivity.this, message);
			dialog.setCancelable(false);

			dialog.show();
		}
	}

	@Override
	protected void onStop() {
		if (null != dialog) {
			dialog.dismiss();
		}
		super.onStop();
	}
}
